package com.kylin.upms.biz.consume;

import com.kylin.upms.biz.model.OperationLog;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "itcast")
public class Springx {

    @Autowired
    MongoTemplate mongoTemplate;
    @RabbitHandler
    public void sendSms(OperationLog operationLog){
        System.out.println("itcast："+operationLog);

        mongoTemplate.save(operationLog,"userdb");
    }

}
